Skip to content

add xtask doctest#2255

Open
tlyu wants to merge 3 commits intorust-lang:masterfrom
tlyu:xtask-doctest
Open

add xtask doctest#2255
tlyu wants to merge 3 commits intorust-lang:masterfrom
tlyu:xtask-doctest

Conversation

@tlyu
Copy link
Copy Markdown
Contributor

@tlyu tlyu commented May 4, 2026

Add a new xtask`` command doctestthat runsmdbook test. This ensures that rustdoc, when run from mdbook`, will use the toolchain override.

fixes #2251

Add a new `xtask`` command `doctest` that runs `mdbook test`. This
ensures that `rustdoc`, when run from `mdbook`, will use the toolchain
override.

fixes rust-lang#2251
@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label May 4, 2026
Copy link
Copy Markdown
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add this, then I think we should also update the documentation to guide users towards the preferred command/workflow. So for example:

  • The Rust code blocks are tested in CI. You can verify that the samples pass by running [`mdbook test`].
  • - [`mdbook test`](#inline-tests) --- Tests the inline Rust code blocks.
  • ## Inline tests
    ```sh
    mdbook test
    ```
    This command runs all tests that are inline in the Markdown. Internally, this uses [`rustdoc`](https://doc.rust-lang.org/rustdoc/) to run the tests and supports all the same features. Any code block with the `rust` language will be compiled unless it is ignored. See [Examples] for more.

View changes since this review

Comment thread tools/xtask/src/main.rs Outdated
Comment thread tools/xtask/src/main.rs Outdated
@tlyu
Copy link
Copy Markdown
Contributor Author

tlyu commented May 4, 2026

Thanks for the review! Oops, I had some edits in progress before I saw your comments. Will incorporate them soon.

Rename the xtask command to `mdbook-test`.

Adjust documentation accordingly. Adjust `OPTIONS`` in xtask.
@tlyu
Copy link
Copy Markdown
Contributor Author

tlyu commented May 4, 2026

I think the latest revision addresses your comments. Please let me know what you think!

@tlyu
Copy link
Copy Markdown
Contributor Author

tlyu commented May 7, 2026

@rustbot label Meta "Authoring guide"

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 7, 2026

Error: Label Meta can only be set by Rust team members

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip.

@tlyu
Copy link
Copy Markdown
Contributor Author

tlyu commented May 7, 2026

@rustbot label "Authoring guide"

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 7, 2026

Error: Label Authoring guide can only be set by Rust team members

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: The marked PR is awaiting review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dev-guide instructions for running tests are incomplete

3 participants